<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>作用域插槽的使用</title>
		<script src="../../vue/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<cpn></cpn>
			<!-- 获取子组件中的数据 -->
			<cpn><!-- 使用div也可以  2.x版本的要使用template -->
				<template slot-scope="slot">
					<span v-for="item in slot.data">{{item}}-</span>
				</template>
			</cpn>
		</div>
		<template id="cp">
			<div id="">
				<h2>谢应鹏</h2>
				<slot :data = 'planguages'><!-- data这个是自己起的名字   -->
					<ul v-for="item  in planguages">
						<li>{{item}}</li>
					</ul>
					
				</slot>
				
			</div>
		</template>
		<script type="text/javascript">
			var spp = new Vue({
				el:'#app',
				data:{
					
				},
				components:{  
					cpn:{
						template:'#cp',
						data(){
							return{
							 planguages:['javascript','java','Python','c']	
							}
						}
					}
				}
				
			});
		</script>
	</body>
</html>
